package com.sakura.tx;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.UUID;

/**
 * @author Sakura
 * @Date 2023-03-08 16:25
 */
@Repository
public class userDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public void insert(){
        String sql = "INSERT INTO `tab_user`(name,age) VALUES (?,?)";
        String name = UUID.randomUUID().toString().substring(0,4);
        jdbcTemplate.update(sql,name,20);
    }
}
